package com.zhipu.hydration.ui.start;

import android.os.Bundle;

import com.blankj.utilcode.util.ActivityUtils;
import com.zhipu.hydration.R;
import com.zhipu.hydration.databinding.ActivityStartBinding;
import com.zhipu.hydration.ui.BaseActivity;
import com.zhipu.hydration.ui.system.SystemActivity;

import in.xiandan.countdowntimer.CountDownTimerSupport;
import in.xiandan.countdowntimer.OnCountDownTimerListener;


/**
 * 启动页
 */
public class StartActivity extends BaseActivity<ActivityStartBinding> {


    private CountDownTimerSupport mTimernumber = new CountDownTimerSupport(2000, 1000);
    @Override
    public void initCreate() {
        super.initCreate();
    }

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_start;
    }

    @Override
    public void initView() {
        super.initView();

        mTimernumber.setOnCountDownTimerListener(new OnCountDownTimerListener() {
            @Override
            public void onTick(long millisUntilFinished) {

            }

            @Override
            public void onFinish() {
                ActivityUtils.startActivity(SystemActivity.class);
                ActivityUtils.finishActivity(StartActivity.class);
            }

            @Override
            public void onCancel() {

            }
        });
        if(null != mTimernumber){
            //倒计时开始
            mTimernumber.reset();
            mTimernumber.start();
        }
    }
}
